function! api#fullscreen#init() abort
    if has('win32')
        if has('win64')
            let g:gvimfullscreen_libname = 'gvimfullscreen.dll.x64'
        else
            let g:gvimfullscreen_libname = 'gvimfullscreen.dll'
        endif
        try
            packadd gvimfullscreen
            let g:gvimfullscreen_lib_list = globpath(&rtp, g:gvimfullscreen_libname, v:true, v:true)
            if !empty(g:gvimfullscreen_lib_list)
                let g:gvimfullscreen_lib = g:gvimfullscreen_lib_list[0]
                if !filereadable(g:gvimfullscreen_lib)
                    " echoerr 'file ' .. g:gvimfullscreen_lib .. ' is not readable!'
                    let g:gvimfullscreen_lib = gvimfullscreen#dll()
                endif
                if filereadable(g:gvimfullscreen_lib)
                    command! ToggleFullScreen call libcallnr(g:gvimfullscreen_lib, 'ToggleFullScreen', 0)
                endif
            endif
        catch /.*/
            echoerr v:exception
        endtry
    else
        command! ToggleFullScreen call system("wmctrl -ir " . v:windowid . " -b toggle,fullscreen")
    endif
    let g:space_keymap = get(g:, 'space_keymap', {})
    let g:toggle_keymap = get(g:, "toggle_keymap", {
                \       'name'  : '+toggle',
                \       'f'     : [':ToggleFullScreen', 'fullscreen']
                \   })
    let g:space_keymap.t = get(g:space_keymap, 't', g:toggle_keymap)
    if empty(maparg('<F11>'))
        nnoremap <F11>  :ToggleFullScreen<cr>
    endif
    if empty(maparg('<m-cr>'))
        nnoremap <m-cr>  :ToggleFullScreen<cr>
    endif
endfunction


